<template>
<div class="">
    <p>
        <span class="tit1">资金使用去向分布</span>
    </p>
    <div ref="chart1" class='' style="width: 100%; height: 300px" />
</div>
</template>

<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
export default {
    components: {},
    props: {},
    data() {
        return {
            chartData: {
                data1: ['基本支出', '项目支出'],
                data2: [{value: 47, name: '基本支出'},{value: 53, name: '项目支出'},],
                data3: [],
                color: ['#FFAE38','#4E7FE6']
            }
        }
    },
    computed: {},
    watch: {

    },
    created() {
        const t = this;
        
    },
    mounted() {
        const t = this;
        t.initChart();
    },
    methods: {
        initChart() {
            this.chart = echarts.init(this.$refs.chart1, 'macarons')
            this.setOptions()
        },
        setOptions() {
            const t = this;
            this.chart.setOption({
                tooltip: {
                    trigger: 'item',
                    formatter: '{b} : {c} ({d}%)'
                },
                legend: {
                    bottom: 10,
                    data: t.chartData.data1
                },
                color: t.chartData.color,
                series: [{
                    type: 'pie',
                    radius: ['50%', '70%'],
                    center: ['50%', '50%'],
                    data: t.chartData.data2,
                    emphasis: {
                        itemStyle: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }]
            })
        }
    }
}
</script>

<style lang="scss" scoped>
</style>
